<?
require_once("config.php");

//connect to the database server
$connection = mysql_connect($dbServer, $dbUser, $dbPass) or die(mysql_error());

//select database
$db = mysql_select_db($dbName, $connection);


//////////////////////////////////////

$q1 = "DROP TABLE IF EXISTS users";
mysql_query($q1) or die(mysql_error()." at row ".__LINE__);

$q1 = "CREATE TABLE users (
	uid int(11) NOT NULL auto_increment,
	name char(50) NOT NULL,
	username varchar(50) default NULL,
	password varchar(50) default NULL,
	email varchar(50) default NULL,
    b_month integer,
    b_year integer,
    b_day integer,
    address varchar(255),
    disabled integer,
    hide_email integer,
    homepage varchar(255),
    icq varchar(20),
    aol varchar(255),
    yahoo varchar(255),
    msn varchar(255),
    interest varchar(255),
    ocupation varchar(255),
    joined integer,
    links text,
	type int(11) NOT NULL default '0',
	forum int(11) NOT NULL default '0',
	PRIMARY KEY  (uid))
	TYPE=MyISAM";
mysql_query($q1) or die(mysql_error()." at row ".__LINE__);



///////////////////////////



$q1 = "DROP TABLE IF EXISTS banners";
mysql_query($q1) or die(mysql_error()." at row ".__LINE__);

$q1 = "CREATE TABLE banners (
	id int unsigned NOT NULL auto_increment,
	html text NOT NULL,
	user int default NULL,
	date int(11) default NULL,
	numImps int(11) default '0',
	numClicks int(11) default '0',
	pos varchar(4) NOT NULL default '',
	PRIMARY KEY  (id))
	TYPE=MyISAM";

mysql_query($q1) or die(mysql_error()." at row ".__LINE__);

///////////////////////////


$q1 = "DROP TABLE IF EXISTS forum";
mysql_query($q1) or die(mysql_error()." at row ".__LINE__);

$q1 = "CREATE TABLE forum (
	id smallint(6) NOT NULL auto_increment,
	name varchar(80) default NULL,
	description text,
	uid int(11) NOT NULL default '0',
	PRIMARY KEY  (id))
	TYPE=MyISAM";

mysql_query($q1) or die(mysql_error()." at row ".__LINE__);

///////////////////////////

$q1 = "DROP TABLE IF EXISTS posts";
mysql_query($q1) or die(mysql_error()." at row ".__LINE__);

$q1 = "CREATE TABLE posts (
	id smallint(6) NOT NULL auto_increment,
	threadid varchar(25) default NULL,
	uid int(11) NOT NULL default '0',
	title varchar(50) default NULL,
	body text,
	timestamp int(12) NOT NULL default '0',
	PRIMARY KEY  (id))
	TYPE=MyISAM";

mysql_query($q1) or die(mysql_error()." at row ".__LINE__);

///////////////////////////

$q1 = "DROP TABLE IF EXISTS thread";
mysql_query($q1) or die(mysql_error()." at row ".__LINE__);

$q1 = "CREATE TABLE thread (
	id smallint(6) NOT NULL auto_increment,
	mb char(3) default NULL,
	uid int(11) NOT NULL default '0',
	title varchar(50) default NULL,
	body text,
	timestamp int(12) NOT NULL default '0',
	PRIMARY KEY  (id))
	TYPE=MyISAM";

mysql_query($q1) or die(mysql_error()." at row ".__LINE__);

///////////////////////////

$q1 = "DROP TABLE IF EXISTS privmsg";
mysql_query($q1) or die(mysql_error()." at row ".__LINE__);

$q1 = "CREATE TABLE privmsg (
	id smallint(6) NOT NULL auto_increment,
	uto int(11) NOT NULL default '0',
	ufrom int(11) NOT NULL default '0',
	title varchar(50) default NULL,
	body text,
	timestamp int(12) NOT NULL default '0',
	new tinyint(4) NOT NULL default '1',
	PRIMARY KEY  (id))
	TYPE=MyISAM";

mysql_query($q1) or die(mysql_error()." at row ".__LINE__);

///////////////////////////




echo "<center><br><br><br><font face=tahoma, verdana, helvetica, arial size=2 color=black><b>The database tables was installed successfully!<br><br>Delete this file from your server!</b></font></center>";


?>